import type {
  EnergyPriceInfo,
  EnergyPriceQueryHistoryListParams,
} from '@/types'

const controller = getAjaxBaseUrl(
  '/energyPrice',
  '/energy',
)

/** 更新能源价格 */
export function updatePrice(params: {
  energyId: number
  energyPrice: number
  energyName: string
}) {
  return post(`${controller}/saveOrUpdateEnergyPrice`, params)
}

/** 获取能源历史价格 */
export function queryHistoryList(params: EnergyPriceQueryHistoryListParams) {
  return post<EnergyPriceInfo[]>(
    `${controller}/selectHistoryEnergyPrice`,
    params,
  )
}
